#include"UdpServer.hpp"
#include"Route.hpp"
#include<memory>

int main(int argc,char *argv[])
{
    if(argc!=2)
    {
        cerr<<"Usage: "<<argv[0]<<"local-port"<<endl;
        exit(0);
    }
    uint16_t port=stoi(argv[1]);
    //string ip=argv[1];
    //string ip="8.8.8.8";
    EnableScreen();

    Route messageRoute;

    service_t message_route = bind(&Route::Forward,&messageRoute,placeholders::_1,placeholders::_2,placeholders::_3);
    //unique_ptr<UdpServer> usvr=make_unique<UdpServer>(port);//c++14标准

    unique_ptr<UdpServer>usvr=make_unique<UdpServer>(message_route,port);
    usvr->InitServer();
    usvr->Start();
    return 0;
}

